<%@page import="com.ddd.entity.Publisher"%>
<%@page import="com.ddd.service.PublisherService"%>
<%@page import="com.ddd.entity.Journal"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.ddd.service.JournalService"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
    String name = request.getParameter("name");
    String foundYear = request.getParameter("foundYear");

    PublisherService publisherService = new PublisherService(request);
    ArrayList publisherList = publisherService.loadAll();


    Parameters para = new Parameters(request);
    String username = para.getUsername();
    Publisher publisher = publisherService.loadByName(username);

    JournalService service = new JournalService(request);
    ArrayList list = service.search(name, foundYear, publisher.getId());

%>
<html xmlns="http://www.w3.org/1999/xjsp">
    <head>
        <meta http-equiv="Content-Type" content="text/jsp; charset=utf-8" />
        <title>期刊資訊</title>
        <link href="../style.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            <!--
            body {
                background-image: url(../images/back-200.gif);
            }
            -->
        </style></head>

    <body>

        <div id="cell">
            <div id="cell2"></div>
            <div id="cell3">
                <div id="cell4"><div  align="center" id="long"  > </div></div>
                <div id="cell5">
                    <div  align="center"> 
                        <%@ include file="../menu.jsp" %>
                    </div>

                </div>
                <div id="cell11">
                    <div id="cell6">
                        <form action="" method="post"  id="froml">
                            <div id="menu">
                                <ul class="subb">
                                    <li><a href="<%=request.getContextPath()%>/FE/Search/Search.jsp" target="_self" class="article"></a></li>
                                    <li><a href="<%=request.getContextPath()%>/FE/Search/journal.jsp" target="_self" class="journal"></a></li>
                                </ul>
                            </div>
                        </form>
                    </div>
                    <div id="cell7">
                        <div id="cell8">
                            <div align="left"><img src="../images/journal_list.png" alt="" width="197" height="62" /></div>
                        </div>
                        <div id="cell9">
                            <%
                                if (list.size() != 0) {
                                    for (int i = 0; i < list.size(); i++) {
                                        Journal j = (Journal) list.get(i);

                                        Publisher p = null;
                                        for (int k = 0; k < publisherList.size(); k++) {
                                            Publisher tmp = (Publisher) publisherList.get(k);
                                            if (j.getFkPublisherId().equals(tmp.getId())) {
                                                p = tmp;
                                                break;
                                            }
                                        }
                            %>
                            <table width="675" border="1">
                                <tr>
                                    <td width="150" rowspan="5">
                                        <label>
                                            <div align="center">
                                                <input type="image" name="journal_img" id="journal_img" src="../images/123.GIF" />
                                            </div>
                                        </label>
                                    </td>
                                    <td width="150" align="right">
                                        期刊名稱：
                                    </td>
                                    <td width="361" align="left"><%=j.getName()%></td>
                                </tr>
                                <tr>
                                    <td width="150" align="right">
                                        出版單位：
                                    </td>
                                    <td align="left"><%=p.getName()%>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="150" align="right">出版週期：</td>
                                    <td align="left"><%=j.getFrequency()%></td>
                                </tr>
                                <tr>
                                    <td width="150" align="right">創刊年：</td>
                                    <td align="left"><%=j.getFoundYear()%></td>
                                </tr>
                                <tr>
                                    <td width="150" align="right">ISSN：</td>
                                    <td align="left"><%=j.getIssn()%></td>
                                </tr>
                            </table>
                            <%}
                            } else {%>
                            查無資料！
                            <%}%>
                        </div>

                    </div>
                </div>
                <div id="cell10">
                    <div align="center" >
                        <p>&nbsp;</p>
                        <p>YOUR JOURNAL資訊    版權所有 © 2011 YOURNAL! Taiwan All Rights Reserved </p>
                    </div></div>

            </div>

            <div id="cell2"></div>

        </div>
    </body>
</html>
